import { DataTypes, INTEGER } from 'sequelize';
import sequelize from '../db/index.js';

const user = sequelize.define(
  'user',
  {
    user_id: {
      type: DataTypes.INTEGER,
      primaryKey: true,
      allowNull: false,
      autoIncrement: true,
      unique: true,
    },
    user_name: {
      type: DataTypes.STRING(255),
      allowNull: false,
    },
    user_password: {
      type: DataTypes.STRING(255),
      allowNull: false,
    },
    user_reputation: {
      type: DataTypes.INTEGER,
      allowNull: true,
      defaultValue: 0,
    },
    user_prefer: {
      type: DataTypes.STRING(255),
      allowNull: true,
    },
    user_permission: {
      type: DataTypes.INTEGER,
      allowNull: true,
      defaultValue: 0,
    },
    user_question_count: {
      type: DataTypes.INTEGER,
      allowNull: true,
      defaultValue: 0,
    },
    user_description: {
      type: DataTypes.STRING(255),
      allowNull: true,
    },
  },
  {
    tableName: 'user',
    timestamps: false,
  },
);

export default user;
